package com.yt.controller;

import com.yt.entity.CommonResult;
import com.yt.entity.Novel;
import com.yt.mapper.NovelMapper;
import com.yt.service.NovelService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class NovelController {
    @Resource
    NovelService novelService;

    @RequestMapping("/novel/{aid}")
    public CommonResult<List<Novel>> getNovelsByAid(@PathVariable("aid")Integer aid){
        CommonResult<List<Novel>> result=new CommonResult<>();
        result.setCode(200);
        result.setInfo("8001,根据作者ID返回小说内容");
        result.setT(novelService.getNovelsByAid(aid));
        return result;
    }

}
